package i_oStream.bufferedStream;

import java.io.*;

public class BufferedByteStream {
    //创建主方法并抛出异常
    public static void main(String[] args) throws IOException {
        //创建缓冲字节输入流对象
        BufferedInputStream bis = new BufferedInputStream(new FileInputStream("D:\\develop\\程序\\JAVAFourDimension-master\\JAVAFourDimension\\src\\I_O\\bufferedStream\\a.txt"));
        //创建缓冲字节输出流对象
        BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream("D:\\develop\\程序\\JAVAFourDimension-master\\JAVAFourDimension\\src\\I_O\\bufferedStream\\c.txt"));
        //创建字节数组并定义拷贝速度
        byte[] bytes = new byte[1024 * 1024 * 5];
        //拷贝长度
        int i;
        //遍历此路径下文件，并调用读入方法，使用字节数组，直至读完整个文件
        while ((i = bis.read(bytes)) != -1) {
            //将读入的字节数组再写入另一个字节数组
            bos.write(bytes, 0, i);
        }
        //释放资源
        bis.close();
        bos.close();
    }
}
